/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package telas;

import tabela.Cabecalho;
import tabela.TabelaModelo;
import controle.ControleTempo;
import javax.swing.JScrollBar;
import javax.swing.table.TableColumn;

/**
 *
 * @author pc
 */
public class ConsultaLiberados extends javax.swing.JDialog {

    ControleTempo controle;
    TabelaModelo tabModelo;
    
    public ConsultaLiberados(java.awt.Frame parent, boolean modal, ControleTempo controle) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo(null);
        this.controle = controle;
        formataTabela();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTTabela = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Eclipse Lan House");

        jTTabela.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTTabela);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 645, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(0, 25, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTTabela;
    // End of variables declaration//GEN-END:variables

    private void formataTabela(){
        tabModelo = new TabelaModelo(controle.getPcs(),controle.getCabecalho());//cria a matriz de acordo com o total de usuarios cadastrados.
        jTTabela.setModel(tabModelo);
        Cabecalho cabecalhoMatriz = new Cabecalho();
        TableColumn tc = jTTabela.getColumn("");
        tc.setCellRenderer(cabecalhoMatriz);
        jScrollPane1.setHorizontalScrollBar(new JScrollBar(0));
        jTTabela.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
    }
}
